import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import vueDevTools from "vite-plugin-vue-devtools";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    vueDevTools(),
    AutoImport({
      dts: "types/auto-imports.d.ts",
      imports: ["vue", "pinia", "vue-router"],
      include: [/\.vue$/, /\.vue\?vue/, /\.ts$/, /\.tsx$/],
    }),
    Components({
      dirs: ["src/components"], // 指定需要自动导入的组件目录
      extensions: ["vue"], // 扩展名
      dts: "types/components.d.ts", // 生成的类型定义文件
    }),
  ],
  resolve: {
    alias: {
      // 路径别名
      "@": "/src",
    },
    extensions: [".js", ".ts", ".vue"],
  },
});
